import numpy as np
from sklearn.linear_model import Ridge
from sklearn.linear_model import SGDRegressor

X = 2 * np.random.rand(100, 1)
y = 4 + 3 * X + np.random.randn(100, 1)

# ridge_re = Ridge(alpha=0.01, solver='sag', max_iter=10000)
# ridge_re.fit(X, y)
#
# print(ridge_re.predict(np.array([1.5]).reshape(-1, 1)))
# print(ridge_re.intercept_)
# print(ridge_re.coef_)

sgd_reg = SGDRegressor(penalty='l2', max_iter=100000)
sgd_reg.fit(X, y.reshape(-1))
print(sgd_reg.predict(np.array([1.5]).reshape(-1, 1)))
print(sgd_reg.intercept_)
print(sgd_reg.coef_)
